package com.wuyou.designPatterns.flyweight;

/**
 * 表示由BigChar组成的"大型字符串"的类
 *
 * @Date 2024/10/18 11:04
 * @Author 无忧
 */
public class BigString {

    private BigChar[] bigChars;
    public BigString(String string){
        bigChars = new BigChar[string.length()];
        BigCharFactory factory = BigCharFactory.getInstance();
        for(int i=0; i<string.length(); i++){
            bigChars[i] = factory.getBigChar(string.charAt(i));
        }
    }

    public void print(){
        for(int i=0; i<bigChars.length; i++){
            bigChars[i].print();
        }
    }
}
